package top.rainf.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.rainf.domain.vo.ClassInfo;
import top.rainf.mapper.ClassInfoMapper;
import top.rainf.service.IClassInfoService;

import java.util.List;

/**
 * @author 星环
 * @date Wed May 10 21:04:41 CST 2023
 * @description ClassInfo服务的实现类
 */
@Service
public class ClassInfoService implements IClassInfoService {

    @Autowired
    ClassInfoMapper classInfoMapper;

    @Override
    public List<ClassInfo> getClassInfoList() {
        return classInfoMapper.selectAll();
    }



    @Override
    public ClassInfo getOneById(int id) {
        return classInfoMapper.selectById(id);
    }

    @Override
    public boolean deleteOneById(int id) {
        return classInfoMapper.deleteById(id) == 1;
    }

    @Override
    public boolean deleteAll(List<Integer> idList) {
        return classInfoMapper.deleteByIds(idList) == idList.size();
    }

    @Override
    public boolean updateById(ClassInfo classInfo) {
        return classInfoMapper.updateById(classInfo) == 1;
    }

    @Override
    public List<ClassInfo> getClassInfoListByBlockId(int id) {
        return classInfoMapper.selectByBlockId(id);
    }
}
